package com.viphome.domain;

import org.hibernate.annotations.Entity;
import org.springframework.data.annotation.Id;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;

/**
 * Created by wangzhanjin on 2017/12/21.
 * 雇员：先开发实体类===》自动生成数据表
 */
@Entity//会根据hbm2ddl.auto看看是否有该表，没有的话会自动生成
public class Employee {

    /**
     * 主键字段,之前用的是int，springdata最好用封装了的类型
     */
    private Integer id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 年龄
     */
    private int age;

    @GeneratedValue
    @Id
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(length = 20)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
